var tests = ["test_global_staticUrlMacro",
             "test_global_signoutMacro",
             "test_global_checkPermissionMacro",
             "test_global_linkFilter",
             "test_global_hrefFilter",
             "test_global_currentClubMacro",
             "test_global_currencyCodeMacro",
             "test_global_currencySymbolMacro",
             "test_global_queryParamsMacro",
             "test_global_switchFilter",
             "test_global_queryParamMacro",
             "test_global_isNullFilter",
             "test_global_formatDecimalFilter",
             "test_global_isBiggerMacro",
             "test_global_booleanFilter",
             "test_global_equalsFilter",
             "test_global_toPercentFilter",
             "test_global_multNegOneFilter",
             "test_global_formatMoneyFilter",
             "test_global_formatDateFilter",
             "test_global_formatTimeFilter",
             "test_global_formatWeekdayFilter",
             "test_global_formatDaymaskForDayFilter",
             "test_global_plusOneDayFilter",
             "test_global_minusOneDayFilter"];

var test_global_staticUrlMacro = function() {
	function param() {
	     this.path = "test";
	   }
	var param = new param();
	assertEqual("/static/tenez/admin/test", staticUrl_macro(param));
};

var test_global_signoutMacro = function() {
	function param() {
	     this.skin = "signoutUser";
	   }
	var param = new param();
	if (session.user) {
		assertEqual(session.user.renderSkinAsString("signoutUser"), signout_macro(param));
	}
	else {
		assertEqual(undefined, signout_macro(param));
	}
};

var test_global_checkPermissionMacro = function() {	
	function param() {
		     this.permission = "can_view_users";
		     this.userHasToBeLoggedIn = true;
		     this.clubLayer = true;
		   }
	var param = new param();	
	assertFalse(checkPermission_macro(param));
};

var test_global_linkFilter = function() {	
	var href = "http://test.test";	
	function param() {
	     this.text = "text";
	     this.href = "";
	}
	var param = new param();		
	assertEqual('<a href="http://test.test">text</a>', link_filter(href, param));
};

var test_global_hrefFilter = function () {	
	function obj() {
		this.href = function (param){
			return param;
		}
	}
	function param() {
	     this.action = "test";
	}	
	var obj = new obj();
	var param = new param();
	assertEqual("test", href_filter(obj, param));
};

var test_global_currentClubMacro = function() {
	assertEqual(null, currentClub_macro());
};

var test_global_currencyCodeMacro = function() {
	assertEqual("", currencyCode_macro());
};

var test_global_currencySymbolMacro = function() {
	assertEqual("", currencySymbol_macro());
};

var test_global_queryParamsMacro = function() {
	function param() {
	     this.name = "customerquery";
	}	
	var param = new param();
	assertEqual(undefined, queryParams_macro(param));
};

var test_global_switchFilter = function() {
	function param() {
		this.thecase = "access";
	}
	var param = new param();
	assertEqual("access", switch_filter("thecase", param));
	assertEqual("", switch_filter("test", param));
};

var test_global_queryParamMacro = function() {
	function param() {
		this.name = "run";
	}
	var param = new param();
	assertEqual("Execute", queryParam_macro(param));
	param.name = null;
	assertFalse(queryParam_macro(param));
};

var test_global_formatDecimalFilter = function() {
	assertEqual("12,5", formatDecimal_filter(12.5, "param"));
};

var test_global_isBiggerMacro = function() {
	function param() {
		this.than = 100;
		this.value = "200";
	}	
	var param = new param();
	assertTrue(isBigger_macro(param));
	param.than = 300;
	assertFalse(isBigger_macro(param));
};

var test_global_booleanMacro = function() {
    assertEqual("TRUERETURN", boolean_filter(true, {'true': "TRUERETURN", 'false': "FALSERETURN"}));
};

var test_global_equalsFilter = function() {
	assertEqual(true, equals_filter("", {'value' : ""}));
	assertEqual(true, equals_filter("asdf", {'value' : "asdf"}));
	assertEqual(false, equals_filter("asdf", {'value' : "asd"}));
	assertEqual(true, equals_filter(1, {'value' : 1}));
	assertEqual(true, equals_filter(1, {'value' : "1"}));
	assertEqual(false, equals_filter(1, {'value' : "0"}));
	assertEqual(false, equals_filter(1, {'value' : 0}));
	assertEqual(true, equals_filter(true, {'value' : true}));
	assertEqual(false, equals_filter(true, {'value' : false}));
}

var test_global_toPercentFilter = function() {
	assertEqual("0.00", toPercent_filter(0));
	assertEqual("0.01", toPercent_filter(0.0001));
	assertEqual("0.10", toPercent_filter(0.001));
	assertEqual("1.00", toPercent_filter(0.01));
	assertEqual("99.00", toPercent_filter(0.99));
	assertEqual("99.99", toPercent_filter(0.9999));
	assertEqual("100.00", toPercent_filter(1));
}

var test_global_multNegOneFilter = function() {
    assertEqual(-1, multNegOne_filter(1));
    assertEqual(1, multNegOne_filter(-1));
    assertEqual(0, multNegOne_filter(0));
    assertEqual(0.99, multNegOne_filter(-0.99));
};

var test_global_formatMoneyFilter = function() {
	assertEqual("0,00", formatMoney_filter(0));
	assertEqual("0,01", formatMoney_filter(0.01));
	assertEqual("100,10", formatMoney_filter(100.1));
	assertEqual("1.000,00", formatMoney_filter(1000));
	assertEqual("-1.000,00", formatMoney_filter(-1000));
	assertEqual("12.345,67", formatMoney_filter(12345.67));
}

var test_global_formatDateFilter = function() {
	assertEqual("12.01.2010", formatDate_filter(new Date(2010,0,12)));
	assertEqual("12.01.2010", formatDate_filter(new Date(2010,0,12,2,3,4)));
	assertEqual("29.02.2008", formatDate_filter(new Date(2008,1,29)));
}

var test_global_formatTimeFilter = function() {
	assertEqual("23:00", formatTime_filter(new Date(2010,0,1,23,00,0)));
	assertEqual("23:00", formatTime_filter(new Date(2000,2,9,23,00,0)));
	assertEqual("00:00", formatTime_filter(new Date(2010,0,1,0,00,0)));
	assertEqual("23:59", formatTime_filter(new Date(2010,0,1,23,59,0)));
	assertEqual("24:00", formatTime_filter(new Date(2010,0,1,23,59,0), {'action' : 'set2359to2400'}));
	assertEqual("00:00", formatTime_filter(new Date(2010,0,1,0,0,0), {'action' : 'set2359to2400'}));
}

var test_global_formatWeekdayFilter = function() {
	assertEqual(gettext("Sonntag"), formatWeekday_filter(new Date(2010,0,3,0,0,0)));
	assertEqual(gettext("Freitag"), formatWeekday_filter(new Date(2008,1,29,0,0,0)));
}

var test_global_formatDaymaskForDayFilter = function() {
	assertEqual("X", formatDaymaskForDay_filter("1000000", {'day' : 1, 'text' : 'X'}));
	assertEqual("asdf", formatDaymaskForDay_filter("1000000", {'day' : 1, 'text' : 'asdf'}));
	assertEqual("", formatDaymaskForDay_filter("1000000", {'day' : 2, 'text' : 'X'}));
	assertEqual("", formatDaymaskForDay_filter("0100000", {'day' : 1, 'text' : 'X'}));
	assertEqual("X", formatDaymaskForDay_filter("0100000", {'day' : 2, 'text' : 'X'}));
	assertEqual("X", formatDaymaskForDay_filter("0000001", {'day' : 7, 'text' : 'X'}));
}

var test_global_plusOneDayFilter = function() {
	assertEqual((new Date(2010,0,1,0,0,0)).getTime(), plusOneDay_filter(new Date(2009,11,31,0,0,0)).getTime());
	assertNotEqual((new Date(2010,0,1,0,0,0)).getTime(), plusOneDay_filter(new Date(2009,0,1,0,0,0)).getTime());
}

var test_global_minusOneDayFilter = function() {
	assertEqual((new Date(2009,11,31,0,0,0)).getTime(), minusOneDay_filter(new Date(2010,0,1,0,0,0)).getTime());
	assertNotEqual((new Date(2010,0,1,0,0,0)).getTime(), minusOneDay_filter(new Date(2009,0,1,0,0,0)).getTime());
}

var test_global_isNullFilter = function() {
	assertEqual(true, isNull_filter(null));
	assertEqual(false, isNull_filter(new Date()));
}
